<template>
  <section>
    <section class="mk-add-pop">
      <el-form ref="formAdd" :model="form" :rules="rules" label-width="140px" class="report-form" :show-message="false">
        <!-- 票机昨日余额 -->
        <div class="group">
          <div class="subheading">
            <p>昨日余额</p>
            <el-divider></el-divider>
          </div>
          <mk-get-row>
            <el-form-item label="现金">
              <el-input v-model="yesterdayDayBalanceMoney" size="mini" clearable readonly></el-input>
            </el-form-item>
          </mk-get-row>
          <mk-get-row>
            <el-form-item label="微信">
              <el-input v-model="yesterday.dayBalanceWechat" size="mini" clearable readonly></el-input>
            </el-form-item>
          </mk-get-row>
          <mk-get-row>
            <el-form-item label="支付宝">
              <el-input v-model="yesterday.dayBalanceAlipay" size="mini" clearable readonly></el-input>
            </el-form-item>
          </mk-get-row>
          <mk-get-row>
            <el-form-item label="体彩机">
              <el-input v-model="yesterday.sportAtThatTime" size="mini" clearable readonly></el-input>
            </el-form-item>
          </mk-get-row>
          <mk-get-row>
            <el-form-item label="福彩机">
              <el-input v-model="yesterday.luckyAtThatTime" size="mini" readonly clearable></el-input>
            </el-form-item>
          </mk-get-row>
          <mk-get-row>
            <el-form-item label="刮刮卡">
              <!-- {{ yesterdayScratchCardAtThatTime }} -->
              <el-input v-model="yesterdayScratchCardAtThatTime" size="mini" clearable readonly></el-input>
            </el-form-item>
          </mk-get-row>
          <mk-get-row>
            <el-form-item label="票机余额合计">
              <el-input v-model="yesterday.totalAtThatTime" size="mini" clearable readonly></el-input>
            </el-form-item>
          </mk-get-row>
        </div>
        <!-- 当日余额 -->
        <div class="group">
          <div class="subheading">
            <p>当日余额</p>
            <el-divider></el-divider>
          </div>
          <mk-get-row>
            <el-form-item label="现金" prop="dayBalanceMoney">
              <el-input-number v-model="form.dayBalanceMoney" size="mini" :precision="2" :controls="false" clearable
                placeholder="请输入当日现金余额"></el-input-number>
            </el-form-item>
          </mk-get-row>
          <mk-get-row>
            <el-form-item label="微信" prop="dayBalanceWechat">
              <el-input-number v-model="form.dayBalanceWechat" size="mini" :precision="2" :controls="false" clearable
                placeholder="请输入当日微信余额"></el-input-number>
            </el-form-item>
          </mk-get-row>
          <mk-get-row>
            <el-form-item label="支付宝" prop="dayBalanceAlipay">
              <el-input-number v-model="form.dayBalanceAlipay" size="mini" :precision="2" :controls="false" clearable
                placeholder="请输入当日支付宝余额"></el-input-number>
            </el-form-item>
          </mk-get-row>
          <!-- <mk-get-row>
            <el-form-item label="收款码" prop="dayBalancePaymentCode">
              <el-input v-model="dayBalancePaymentCode" size="mini" readonly clearable placeholder="请输入当日收款码余额"></el-input>
            </el-form-item>
          </mk-get-row> -->
          <mk-get-row>
            <el-form-item label="当日余额合计" prop="dayBalanceAllMoney">
              <el-input v-model="dayBalanceAllMoney" size="mini" clearable readonly placeholder="自动合计当日余额"></el-input>
            </el-form-item>
          </mk-get-row>
        </div>
        <!-- 当日收入 -->
        <div class="group">
          <div class="subheading">
            <p>当日收入</p>
            <el-divider></el-divider>
          </div>
          <mk-get-row>
            <el-form-item label="现金" prop="dayIncomeMoney">
              <el-input v-model="dayIncomeMoney" size="mini" clearable readonly placeholder="请输入当日现金收入"></el-input>
            </el-form-item>
          </mk-get-row>
          <mk-get-row>
            <el-form-item label="微信" prop="dayIncomeWechat">
              <el-input v-model="dayIncomeWechat" size="mini" readonly clearable placeholder="请输入当日微信收入"></el-input>
            </el-form-item>
          </mk-get-row>
          <mk-get-row>
            <el-form-item label="支付宝" prop="dayIncomeAlipay">
              <el-input v-model="dayIncomeAlipay" size="mini" readonly clearable placeholder="请输入当日支付宝收入"></el-input>
            </el-form-item>
          </mk-get-row>
          <mk-get-row>
            <el-form-item label="收款码" prop="dayIncomePaymentCode">
              <el-input-number v-model="form.dayIncomePaymentCode" size="mini" :precision="2" :controls="false" clearable
                placeholder="请输入当日收款码收入"></el-input-number>
            </el-form-item>
          </mk-get-row>
          <mk-get-row>
            <el-form-item label="刮刮卡转入" prop="dailyIncomeScrapingCard" class="color-blue">
              <el-input-number v-model="form.dailyIncomeScrapingCard" size="mini" :precision="2" :controls="false"
                clearable placeholder="请输入当日刮刮卡转入"></el-input-number>
            </el-form-item>
          </mk-get-row>
          <mk-get-row>
            <el-form-item label="刮刮卡转出（当日）" prop="dailyOutScrapingCard" class="color-red">
              <el-input-number v-model="form.dailyOutScrapingCard" size="mini" :precision="2" :controls="false" clearable
                placeholder="请输入当日刮刮卡收出"></el-input-number>
            </el-form-item>
          </mk-get-row>
          <mk-get-row>
            <el-form-item label="刮刮卡转出（次日）" prop="nextDailyOutScrapingCard" class="color-red">
              <el-input-number v-model="form.nextDailyOutScrapingCard" size="mini" :precision="2" :controls="false"
                clearable placeholder="请输入当日刮刮卡收出"></el-input-number>
            </el-form-item>
          </mk-get-row>
          <mk-get-row>
            <el-form-item label="当日收入合计" prop="dayIncomeAllMoney">
              <el-input v-model="dayIncomeAllMoney" size="mini" clearable readonly placeholder="自动合计当日收入"></el-input>
            </el-form-item>
          </mk-get-row>
        </div>
        <!-- 应交款（当日销售） -->
        <div class="group-four">
          <div class="subheading">
            <p>应交款（当日销售）</p>
            <el-divider></el-divider>
          </div>
          <mk-get-row>
            <el-form-item label="体彩应交款" prop="sportPayables">
              <el-input-number v-model="form.sportPayables" size="mini" :min="0" :precision="2" :controls="false"
                clearable placeholder="请输入体彩应交款"></el-input-number>
            </el-form-item>
          </mk-get-row>
          <mk-get-row>
            <el-form-item label="福彩应交款" prop="luckyPayables">
              <el-input-number v-model="form.luckyPayables" size="mini" :min="0" :precision="2" :controls="false"
                clearable placeholder="请输入福彩应交款"></el-input-number>
            </el-form-item>
          </mk-get-row>
          <mk-get-row>
            <el-form-item label="刮刮卡应交款" prop="scratchCardPayables">
              <el-input v-model="scratchCardPayables" size="mini" :min="0" clearable placeholder="请输入刮刮卡应交款"
                readonly></el-input>
            </el-form-item>
          </mk-get-row>
          <mk-get-row>
            <el-form-item label="应交款合计" prop="totalPayables">
              <el-input v-model="totalPayables" size="mini" clearable readonly placeholder="自动合计应交款"></el-input>
            </el-form-item>
          </mk-get-row>
        </div>
        <!-- 票机当日余额 -->
        <div class="group-four">
          <div class="subheading">
            <p>票机当日余额</p>
            <el-divider></el-divider>
          </div>
          <mk-get-row>
            <el-form-item label="体彩机" prop="sportAtThatTime">
              <el-input-number v-model="form.sportAtThatTime" size="mini" :precision="2" :controls="false" clearable
                placeholder="请输入体彩机当日余额"></el-input-number>
            </el-form-item>
          </mk-get-row>
          <mk-get-row>
            <el-form-item label="福彩机" prop="luckyAtThatTime">
              <el-input-number v-model="form.luckyAtThatTime" size="mini" :precision="2" :controls="false" clearable
                placeholder="请输入福彩机当日余额"></el-input-number>
            </el-form-item>
          </mk-get-row>
          <mk-get-row>
            <el-form-item label="刮刮卡" prop="scratchCardAtThatTime">
              <el-input-number v-model="form.scratchCardAtThatTime" size="mini" :precision="2" :controls="false" clearable
                placeholder="请输入刮刮卡当日余额"></el-input-number>
            </el-form-item>
          </mk-get-row>
          <mk-get-row>
            <el-form-item label="票机余额合计" prop="totalAtThatTime">
              <el-input v-model="totalAtThatTime" size="mini" clearable readonly placeholder="自动合计当日票机余额"></el-input>
            </el-form-item>
          </mk-get-row>
        </div>
        <!-- 兑奖 -->
        <div class="group-four">
          <div class="subheading">
            <p>兑奖</p>
            <el-divider></el-divider>
          </div>
          <mk-get-row>
            <el-form-item label="体彩彩票兑奖" prop="sportVoteCashPrize">
              <el-input-number v-model="form.sportVoteCashPrize" size="mini" :precision="2" :controls="false" clearable
                placeholder="请输入体彩彩票兑奖"></el-input-number>
            </el-form-item>
          </mk-get-row>
          <mk-get-row>
            <el-form-item label="福彩兑奖" prop="luckyLotteryRedemption">
              <el-input-number v-model="form.luckyLotteryRedemption" size="mini" :precision="2" :controls="false"
                clearable placeholder="请输入福彩兑奖"></el-input-number>
            </el-form-item>
          </mk-get-row>
          <mk-get-row>
            <el-form-item label="体彩刮刮卡兑奖" prop="sportScratchCardCashAPrize">
              <el-input-number v-model="form.sportScratchCardCashAPrize" size="mini" :precision="2" :controls="false"
                clearable placeholder="请输入体彩刮刮卡兑奖"></el-input-number>
            </el-form-item>
          </mk-get-row>
          <mk-get-row>
            <el-form-item label="兑奖合计" prop="redemptionAllMoney">
              <el-input v-model="redemptionAllMoney" size="mini" clearable readonly placeholder="自动合计兑奖"></el-input>
            </el-form-item>
          </mk-get-row>
        </div>
        <!-- 佣金 -->
        <div class="group-four">
          <div class="subheading">
            <p>佣金</p>
            <el-divider></el-divider>
          </div>
          <mk-get-row>
            <el-form-item label="体彩佣金" prop="sportsLotteryCommission">
              <el-input v-model="sportsLotteryCommission" size="mini" clearable placeholder="请输入体彩佣金" readonly></el-input>
            </el-form-item>
          </mk-get-row>
          <mk-get-row>
            <el-form-item label="福彩佣金" prop="luckyLotteryCommission">
              <el-input v-model="luckyLotteryCommission" size="mini" clearable placeholder="请输入福彩佣金" readonly></el-input>
            </el-form-item>
          </mk-get-row>
          <mk-get-row>
            <el-form-item label="刮刮卡佣金" prop="scrapingCardCommission">
              <el-input v-model="scrapingCardCommission" size="mini" clearable placeholder="请输入福彩佣金" readonly></el-input>
            </el-form-item>
          </mk-get-row>
        </div>
        <!-- 杂项 -->
        <div class="separate">
          <div class="subheading">
            <p>杂项</p>
            <el-divider></el-divider>
          </div>
          <mk-get-row>
            <el-form-item label="差异" prop="difference" :class="difference >= 0 ? 'color-blue' : 'color-red'">
              <el-input v-model="difference" size="mini" clearable readonly placeholder="自动合计当日收入"></el-input>
            </el-form-item>
          </mk-get-row>
          <mk-get-row>
            <el-form-item label="体彩充值金额" prop="sportRechargeAmount">
              <el-input-number v-model="form.sportRechargeAmount" size="mini" :min="0" :precision="2" :controls="false"
                clearable placeholder="请输入体彩充值金额"></el-input-number>
            </el-form-item>
          </mk-get-row>
          <mk-get-row>
            <el-form-item label="微信充值" prop="weChatRecharge">
              <el-input-number v-model="form.weChatRecharge" size="mini" :min="0" :precision="2" :controls="false"
                clearable placeholder="请输入微信充值"></el-input-number>
            </el-form-item>
          </mk-get-row>
          <mk-get-row>
            <el-form-item label="百元现金取走量" prop="cashWithdrawalAmountOf100">
              <el-input-number v-model="form.cashWithdrawalAmountOf100" size="mini"
                oninput="value=value.replace(/[^\d]/g,'')" clearable :controls="false"
                placeholder="请输入百元现金取走量"></el-input-number>
            </el-form-item>
          </mk-get-row>
          <mk-get-row>
            <el-form-item label="福彩充值金额" prop="luckyRechargeAmount">
              <el-input-number v-model="form.luckyRechargeAmount" size="mini" :min="0" :precision="2" :controls="false"
                clearable placeholder="请输入福彩充值金额"></el-input-number>
            </el-form-item>
          </mk-get-row>
          <mk-get-row>
            <el-form-item label="支付宝充值" prop="alipayRecharge">
              <el-input-number v-model="form.alipayRecharge" size="mini" :min="0" :precision="2" :controls="false"
                clearable placeholder="请输入支付宝充值"></el-input-number>
            </el-form-item>
          </mk-get-row>
          <mk-get-row>
            <el-form-item label="取走人" prop="takeAwayPeople">
              <el-input v-model="form.takeAwayPeople" size="mini" clearable placeholder="请输入取走人"></el-input>
            </el-form-item>
          </mk-get-row>
          <mk-get-row>
            <el-form-item label="体彩订卡金额" prop="sportCardSubscriptionAmount">
              <el-input-number v-model="form.sportCardSubscriptionAmount" size="mini" :precision="2" :controls="false"
                clearable placeholder="请输入体彩订卡金额"></el-input-number>
            </el-form-item>
          </mk-get-row>
          <div style="width: 385px;height: 35px;"></div>
          <div style="width: 385px;height: 35px;"></div>
          <mk-get-row>
            <el-form-item label="福彩订卡金额" prop="luckyCardSubscriptionAmount">
              <el-input-number v-model="form.luckyCardSubscriptionAmount" size="mini" :precision="2" :controls="false"
                clearable placeholder="请输入福彩订卡金额"></el-input-number>
            </el-form-item>
          </mk-get-row>
          <!-- <mk-get-row>
            <el-form-item label="替班人员" prop="substitutePersonnel">
              <el-input v-model="form.substitutePersonnel" size="mini" clearable placeholder="请输入替班人员"></el-input>
            </el-form-item>
          </mk-get-row> -->
          <mk-get-row style="width: 100%;height: 370px;">
            <el-form-item label="备注" prop="notes">
              <el-tabs v-model="activeName" type="border-card" style="width: 950px">
                <el-tab-pane label="Markdown" name="md">
                  <mk-md-editor v-model="form.notes" :height="300" mode="edit" />
                </el-tab-pane>
              </el-tabs>
            </el-form-item>
          </mk-get-row>
        </div>
        <el-divider />
        <mk-get-button @save="pretreatment" @close="close(true)" />
      </el-form>
    </section>
  </section>
</template>

<script>
import util from "@/libs/util";
import MkGetRow from "@/components/common/mk-get-row";
import MkGetButton from "@/components/common/mk-get-button";
import MkBackList from "@/components/common/mk-back-list";
import { dirReportCreate, dirReportUpdate, lastDayData } from "@/api/modules/sys.report.api";
import MkSelectRole from "@/components/common/mk-select-role";
import Tools from '@/libs/utils.tool'
import MkMdEditor from "@/components/md-editor";

export default {
  name: 'get-report-info',
  components: { MkSelectRole, MkBackList, MkGetButton, MkGetRow, MkMdEditor },
  props: {
    updateData: {
      type: Object,
      default() {
        return {}
      }
    },
    pre: {
      type: Object,
      default() {
        return {}
      }
    },
  },
  created() {
    if (this.pre) {
      this.form['dayDate'] = this.pre.dayDate
      this.form['shop'] = this.pre.shop
    }
    this.getYesterdayData();
    if (this.updateData && this.updateData.id) {
      this.form = this.updateData
      this.isAdd = false
    }
  },
  data() {
    return {
      activeName: 'md',
      commonKey: 0,
      form: {
        state: true,
        dayBalanceMoney: 0,
        dayBalanceWechat: 0,
        dayBalanceAlipay: 0,
        dayIncomePaymentCode: 0,
        dailyIncomeScrapingCard: 0,
        sportPayables: 0,
        luckyPayables: 0,
        scratchCardPayables: 0,
        sportAtThatTime: 0,
        luckyAtThatTime: 0,
        sportVoteCashPrize: 0,
        sportScratchCardCashAPrize: 0,
        luckyLotteryRedemption: 0,
        sportsLotteryCommission: 0,
        luckyLotteryCommission: 0,
        scratchCardAtThatTime: 0,
        sportRechargeAmount: 0,
        luckyRechargeAmount: 0,
        sportCardSubscriptionAmount: 0,
        luckyCardSubscriptionAmount: 0,
        weChatRecharge: 0,
        alipayRecharge: 0,
        cashWithdrawalAmountOf100: 0,
        dailyOutScrapingCard: 0,
        nextDailyOutScrapingCard: 0
      },
      yesterday: {
        totalAtThatTime: 0,
        scratchCardAtThatTime: 0,
        luckyAtThatTime: 0,
        sportAtThatTime: 0,
        dayBalanceMoney: 0,
        dayBalanceAlipay: 0,
        dayBalanceWechat: 0,
      },
      isAdd: true,
      rules: {
        dayIncomePaymentCode: [{ required: true, message: '请输入当日收款码收入', trigger: 'blur' }],
        sportVoteCashPrize: [{ required: true, message: '请输入体彩彩票兑奖金额', trigger: 'blur' }],
        sportScratchCardCashAPrize: [{ required: true, message: '请输入体彩刮刮卡兑奖金额', trigger: 'blur' }],
        luckyLotteryRedemption: [{ required: true, message: '请输入福彩兑奖金额', trigger: 'blur' }],
        sportPayables: [{ required: true, message: '请输入体彩应交款', trigger: 'blur' }],
        luckyPayables: [{ required: true, message: '请输入福彩应交款', trigger: 'blur' }],
        sportAtThatTime: [{ required: true, message: '请输入体彩机当日余额', trigger: 'blur' }],
        luckyAtThatTime: [{ required: true, message: '请输入福彩机当日余额', trigger: 'blur' }],
        scratchCardAtThatTime: [{ required: true, message: '请输入刮刮卡当日余额', trigger: 'blur' }],
        sportRechargeAmount: [{ required: true, message: '请输入体彩充值金额', trigger: 'blur' }],
        luckyRechargeAmount: [{ required: true, message: '请输入福彩充值金额', trigger: 'blur' }],
        sportCardSubscriptionAmount: [{ required: true, message: '请输入体彩订卡金额', trigger: 'blur' }],
        luckyCardSubscriptionAmount: [{ required: true, message: '请输入福彩订卡金额', trigger: 'blur' }],
        weChatRecharge: [{ required: true, message: '请输入微信充值金额', trigger: 'blur' }],
        alipayRecharge: [{ required: true, message: '请输入支付宝充值金额', trigger: 'blur' }]
      },
      yesterdayScratchCardAtThatTime: 0,
      yesterdayDayBalanceMoney: 0, // 昨日余额现金
    }
  },
  methods: {
    // 获取上一日数据
    getYesterdayData() {
      lastDayData({
        dayDate: "'" + this.pre.dayDate + "'",
        shop: "'" + this.pre.shop + "'"
      }).then(res => {
        if (res[0]) {
          this.yesterday = res[0];
          // this.yesterday.scratchCardAtThatTime = this.retNum(this.yesterday.scratchCardAtThatTime) - this.retNum(this.yesterday.dailyOutScrapingCard);
          console.log(this.yesterday);
          // 昨日余额
          // 昨日转出等于0 直接取结余
          // 昨日转出小于转入

          // 昨日转入小于转出
          // if(this.yesterday.dailyOutScrapingCard < this.yesterday.dailyIncomeScrapingCard){
          //  + this.retNum(this.yesterday.dailyIncomeScrapingCard)

          this.yesterdayScratchCardAtThatTime = (this.retNum(this.yesterday.scratchCardAtThatTime) - this.retNum(this.yesterday.nextDailyOutScrapingCard)).toFixed(2)
          // this.yesterdayScratchCardAtThatTime = (this.retNum(this.yesterday.scratchCardAtThatTime) - this.retNum(this.yesterday.dailyOutScrapingCard) + this.retNum(this.yesterday.dailyIncomeScrapingCard)).toFixed(2)

          // }
          // 昨日转入  昨日转出0
          // this.yesterdayScratchCardAtThatTime = (this.retNum(this.yesterday.scratchCardAtThatTime).toFixed(2)
          // this.yesterdayScratchCardAtThatTime = (this.retNum(this.yesterday.scratchCardAtThatTime) - this.retNum(this.yesterday.dailyOutScrapingCard) + this.retNum(this.yesterday.dailyIncomeScrapingCard)).toFixed(2)

          // 昨日余额减去昨日转出刮刮卡  yesterday.scratchCardAtThatTime  -  yesterday.dailyOutScrapingCard
          this.yesterdayDayBalanceMoney = (this.retNum(this.yesterday.dayBalanceMoney) - (this.retNum(this.yesterday.cashWithdrawalAmountOf100) * 100)).toFixed(2)
        }
      }).catch(res => {
        this.yesterday = {
          sportAtThatTime: 0,
          luckyAtThatTime: 0,
          scratchCardAtThatTime: 0,
          totalAtThatTime: 0,
          dayBalanceMoney: 0,
          dayBalanceAlipay: 0,
          dayBalanceWechat: 0,
        }
      })
    },
    // 提交预处理
    pretreatment() {
      const time = Tools.fmtLong2DateTime(Date.now(), 'hh')
      if (time >= 0 && time < 2) {
        this.$toast.warning(`当前时间为${Tools.fmtLong2DateTime(Date.now())}，请确认提交日期`)
      }
      this.save()
    },
    // 提交
    save() {
      this.$refs['formAdd'].validate((valid) => {
        if (valid) {
          // 数据处理，处理未添加的数据
          this.form['substitutePersonnel'] = JSON.parse(util.cookies.get('userInfo')).nickName
          this.form['dayIncomeAllMoney'] = this.dayIncomeAllMoney
          this.form['dayBalanceAllMoney'] = this.dayBalanceAllMoney
          this.form['totalPayables'] = this.totalPayables
          this.form['totalAtThatTime'] = this.totalAtThatTime
          this.form['difference'] = this.difference
          this.form['presenter'] = util.cookies.get('uuid')
          this.form['sportsLotteryCommission'] = this.sportsLotteryCommission
          this.form['luckyLotteryCommission'] = this.luckyLotteryCommission
          this.form['scratchCardPayables'] = this.scratchCardPayables
          this.form['dayIncomeMoney'] = this.dayIncomeMoney
          this.form['dayIncomeWechat'] = this.dayIncomeWechat
          this.form['dayIncomeAlipay'] = this.dayIncomeAlipay
          this.form['redemptionAllMoney'] = this.redemptionAllMoney
          this.form['scrapingCardCommission'] = this.scrapingCardCommission

          // 默认0
          this.form['dayBalancePaymentCode'] = 0

          let _FUC = ''
          _FUC = this.isAdd ? dirReportCreate : dirReportUpdate
          _FUC(this.form).then(res => {
            this.$toast.success(this.isAdd ? '添加成功！' : '修改成功！')
            this.$emit('close', true)
          }).catch(err => {
            console.log(err)
          })
        } else {
          this.$toast.error(`请填写全部必填项！`)
          console.log('error submit!!')
          return false
        }
      });
    },
    close(show) {
      if (show) {
        this.$toast.confirmSave().then(() => {
          this.$emit('close');
        });
      } else {
        this.$emit('close');
      }
    },
    // 处理数据格式
    retNum(val) {
      return Number(val) || 0
    }
  },
  computed: {
    // 收入合计
    dayIncomeAllMoney() {
      return (this.retNum(this.dayIncomeMoney) + this.retNum(this.dayIncomeWechat) + this.retNum(this.dayIncomeAlipay) + this.retNum(this.form.dayIncomePaymentCode)).toFixed(2)
    },
    // 余额合计
    dayBalanceAllMoney() {
      return (this.retNum(this.form.dayBalanceMoney) + this.retNum(this.form.dayBalanceWechat) + this.retNum(this.form.dayBalanceAlipay)).toFixed(2)
    },
    // 应交款合计
    totalPayables() {
      return (this.retNum(this.form.sportPayables) + this.retNum(this.form.luckyPayables) + this.retNum(this.scratchCardPayables)).toFixed(2)
    },
    // 票机当日余额合计
    totalAtThatTime() {
      return (this.retNum(this.form.sportAtThatTime) + this.retNum(this.form.luckyAtThatTime) + this.retNum(this.form.scratchCardAtThatTime)).toFixed(2)
    },
    // 差异
    difference() {
      // return (this.retNum(this.form.weChatRecharge) + this.retNum(this.dayIncomeAllMoney) + this.retNum(this.form.sportVoteCashPrize) + this.retNum(this.form.sportScratchCardCashAPrize) + this.retNum(this.form.luckyLotteryRedemption) - this.retNum(this.totalPayables)).toFixed(2)
      // - this.retNum(this.form.dayIncomePaymentCode)   减去收款码去掉了
      return (this.retNum(this.redemptionAllMoney) + (this.retNum(this.dayIncomeAllMoney)) - this.retNum(this.totalPayables)).toFixed(2)
    },
    // 体彩佣金
    sportsLotteryCommission() {
      return (this.retNum(this.form.sportPayables) * 0.07).toFixed(2)
    },
    // 福彩佣金
    luckyLotteryCommission() {
      return (this.retNum(this.form.luckyPayables) * 0.08).toFixed(2)
    },
    // 刮刮卡佣金
    scrapingCardCommission() {
      return (this.retNum(this.scratchCardPayables) * 0.072).toFixed(2)
    },
    // 刮刮卡应交款
    scratchCardPayables() {
      // 昨日余额刮刮卡  没有减去  昨天的转出转入
      // scratchCardAtThatTime 票机当日余额刮刮卡   dailyIncomeScrapingCard 刮刮卡转入  scratchCardAtThatTime 票机当日余额刮刮卡  dailyOutScrapingCard  刮刮卡转出
      // + this.retNum(this.form.dailyIncomeScrapingCard) - this.retNum(this.form.dailyOutScrapingCard)
      return (this.retNum(this.yesterdayScratchCardAtThatTime) + this.retNum(this.form.dailyIncomeScrapingCard) - this.retNum(this.form.scratchCardAtThatTime) - this.retNum(this.form.dailyOutScrapingCard)).toFixed(2)
    },
    // 当日收入现金
    dayIncomeMoney() {
      //  - (this.retNum(this.yesterday.cashWithdrawalAmountOf100) * 100)
      return (this.retNum(this.form.dayBalanceMoney) - this.retNum(this.yesterdayDayBalanceMoney)).toFixed(2)
      // return (this.retNum(this.form.dayBalanceMoney) - this.retNum(this.yesterday.dayBalanceMoney) - (this.retNum(this.yesterday.cashWithdrawalAmountOf100) * 100)).toFixed(2)
    },
    // 当日收入微信
    dayIncomeWechat() {
      return (this.retNum(this.form.dayBalanceWechat) - this.retNum(this.yesterday.dayBalanceWechat) - this.retNum(this.form.weChatRecharge)).toFixed(2)
    },
    // 当日收入支付宝
    dayIncomeAlipay() {
      return (this.retNum(this.form.dayBalanceAlipay) - this.retNum(this.yesterday.dayBalanceAlipay)).toFixed(2)
    },
    // 兑奖合计
    redemptionAllMoney() {
      return (this.retNum(this.form.sportScratchCardCashAPrize) + this.retNum(this.form.luckyLotteryRedemption) + this.retNum(this.form.sportVoteCashPrize)).toFixed(2)
    },
  }
}
</script>

<style lang="scss">
.subheading {
  width: 100%;

  p {
    text-align: center;
    margin: 0;
  }

  .el-divider--horizontal {
    margin: 8px 0 8px 0;
  }
}

.report-form {
  display: flex;
  flex-wrap: wrap;

  .separate {
    display: flex;
    flex-wrap: wrap;
  }

  .el-input {
    height: 35px;
  }

  .el-input--suffix .el-input__inner {
    padding-right: 15px;
  }

  .el-input__inner {
    text-align: center;
    width: 245px;
    line-height: 35px;
  }

  .el-form-item__content {
    height: 35px;
    line-height: 35px;
    width: 245px;
  }

  .el-form-item {
    margin-bottom: 0;
  }

  .el-form-item__label {
    line-height: 35px;
  }

  .color-blue {
    font-weight: bold;

    .el-form-item__label {
      color: #409EFF;
      font-size: 18px;
    }
  }

  .color-red {
    font-weight: bold;

    .el-form-item__label {
      color: red;
      font-size: 14px;
    }
  }

  .group-four {
    .el-input__inner {
      width: 150px;
    }

    .el-form-item__content {
      width: 150px;
    }
  }

  input[readonly] {
    background-color: #ededed;
  }
}
</style>
